import numpy as np

def de_casteljau(points, t):
    """ 使用 de Casteljau 算法计算Bezier曲线上的点 """
    n = len(points)
    points = np.array(points, dtype=float)
    for r in range(1, n):
        for i in range(n - r):
            points[i] = (1 - t) * points[i] + t * points[i + 1]
        print(f"Step {r}: {points[:n-r]}")  # 打印每步的控制点
    return points[0]

# 控制点
control_points = [(30,0), (60,10), (80,30), (90,60), (90,90)]
# 计算 t=0.4 处的Bezier点
bezier_point = de_casteljau(control_points, 0.75)
print("Bezier point at t=0.25:", bezier_point)
